#include "diausers.h"
#include "ui_diausers.h"

DiaUsers::DiaUsers(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::DiaUsers)
{
    ui->setupUi(this);
    // default color is Black
    this->ui->le_color->setText("#000000");
}

DiaUsers::~DiaUsers()
{
    delete ui;
}

void DiaUsers::setUsername(const QString &name){
    this->ui->le_user->setText(name);
}

void DiaUsers::setColor(const QString &color){
    this->ui->le_color->setText(color);
}

void DiaUsers::setUserType(int type){
    this->ui->comboBox->setCurrentIndex(type);
}

QString DiaUsers::getUsername(){
    return this->ui->le_user->text();
}

QString DiaUsers::getUserpass(){
    return this->ui->le_pass->text();
}

QString DiaUsers::getColor(){
    return this->ui->le_color->text();
}

int DiaUsers::getUserType(){
    return this->ui->comboBox->currentIndex();
}

void DiaUsers::callColorDia(){
    QColorDialog cdia(QColor(this->ui->le_color->text()));
    if(cdia.exec()){
    //QString QColor::name () const
        this->ui->le_color->setText(cdia.currentColor().name());
    }
}
